//
//  FileManager.m
//  FroadTest
//
//  Created by 陈 利群 on 14/11/11.
//  Copyright (c) 2014年 froad. All rights reserved.
//

#import "FileManager.h"

#import "ServerIPModel.h"
//#import "ZipArchive.h"

@implementation FileManager

#pragma mark - 单一实例
static FileManager *sharedFileManager = nil;

+ (FileManager *)sharedFileManager {
    @synchronized(self){  // 防止多线程同事访问
        if (sharedFileManager == nil) {
            sharedFileManager = [[FileManager alloc] init];
        }
        return sharedFileManager;
    }
}

#pragma mark - //读取各种文件接口

- (NSDictionary*) getJsonDataByFileName:(NSString*) fileName
{
    NSString *jsonDataPath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"json"];
    
    NSData *jsonData = [NSData dataWithContentsOfFile:jsonDataPath];
    NSError * parserError ;
    NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&parserError];
    return jsonDic;
}



//- (BOOL)unZipOpenFile:(NSString *)fileName toPath:(NSString *)path withPassword:(NSString *)password
//{
//    BOOL success;
//    ZipArchive* zipFile = [[ZipArchive alloc] init];
//    success =[zipFile UnzipOpenFile:fileName Password:password];
//    if (success) {
//        success = [zipFile UnzipFileTo:path overWrite:YES];
//    }
//    [zipFile UnzipCloseFile];
//    return success;
//    
//}
@end
